<?php

namespace App\Http\Requests;

class ResourceCreateRequest extends BaseRequest
{
    /**
     * Get the validation rules that apply to the request.
     * @return string[]
     */
    public function rules(): array
    {
        return [
            'name' => ['required','unique:admin_resources'],
            'url' => ['required'],
            'category_id' => ['required'],
        ];
    }

    public function messages(): array
    {
        return [
            'name.required' => '资源名称不能为空',
            'name.unique' => '资源名称已存在',
            'url.unique' => '资源名称url不能为空',
            'category_id.unique' => '资源分类不能为空',
        ];
    }
}

